//
//  privateAndPublic.hpp
//  learnC++
//
//  Created by apple on 2018/6/2.
//  Copyright © 2018年 yunfan.com. All rights reserved.
//

#ifndef privateAndPublic_hpp
#define privateAndPublic_hpp

#include <stdio.h>
#include <iostream>

class TodayClass{
    
    // private by default
    int m_year;
    int m_month;
    int m_day;
    
    
public:
    void setDate(int month, int day, int year) // public, can be accessed by anyone
    {
        // setDate() can access the private members of the class because it is a member of the class itself
        m_month = month;
        m_day = day;
        m_year = year;
    }
    
    void print() // public, can be accessed by anyone
    {
        std::cout << m_month << "/" << m_day << "/" << m_year << "\n";
    }
    
    void copyFrom(const TodayClass &d){
//        请注意，我们可以直接访问d的私有成员
//        访问控制是按照每个类而不是每个对象来进行的
        m_month = d.m_month;
        m_day = d.m_day;
        m_year = d.m_year;
    }
    
};



#endif /* privateAndPublic_hpp */
